<?php
//Базовый контроллер конкретного приложения
class ExtController extends AppController {
	protected $catalog_data, $catalog_tree;
	
	function __construct($params) {
		parent::__construct($params);
		$this->addJS('onload');
		$this->createMenu();
	}
	
	function createMenu() {
		$set = new MyCatalogueSet();
        $nodes = $set->get();
        $data = array();
        generateTree($data, $nodes[1], $nodes, array('idn', 'title'), 'idn');
		
        $this->catalog_data = $data;
		
		$tree_data = array();
		generateTree($tree_data, $nodes[1], $nodes, array('idn', 'title'), 'id');
		$this->catalog_tree = array($tree_data['id']=>$tree_data);
		
        $res = '';
        $segments = array();
        $data = renderUrlTree($data, 0, $segments);
        $this->addBlockData('left_menu', 'menu', simpleRenderTree($data, 0, $res, 2));		
	}
}
?>